<extend name="Public/base"/>

<block name="style">
    <link rel="stylesheet" type="text/css" href="__CSS__/order.css" media="all">
</block>

<block name="body">
    <!-- 标题 -->
    <div class="main-title">
        <h2>秒杀商品列表</h2>
    </div>

    <!-- 按钮工具栏 -->
    <div class="cf">
        <div class="fl">
            <!--  <div class="btn-group">
               <a class="btn item_add" href="{:U('Item/add')}">新 增</a>
             </div> -->
            <button class="btn ajax-post confirm" target-form="ids" url="{:U('Item/setStatus',array('status'=>-1))}">删 除</button>
            <!--   <button class="btn ajax-post" target-form="ids" url="{:U('Item/setStatus',array('status'=>1))}">上 架</button>
              <button class="btn ajax-post confirm" target-form="ids" url="{:U('Item/setStatus',array('status'=>0))}">下 架</button> -->
        </div>

        <!-- 高级搜索 -->

    </div>

    <table class="order-table-head">
        <tr>
            <th width="30">
                <input class="checkbox check-all" type="checkbox">
            </th>
            <th width="370">商品基本信息</th>

            <th width="105" class="text-center">原价</th>
            <th width="105" class="text-center">活动库存</th>
            <th width="105" class="text-center">秒杀价</th>
            <th width="140" class="text-center">状态</th>
            <th width="140" class="text-center">操作</th>

        </tr>
    </table>
    <notempty name="list">
        <volist name="items" key='key' id="vo">
            <table class="order-table status-{$vo['status'] < 0 ? 0 : $vo['status']}">
                <tr>
                    <th colspan="10">
                        <span class="text-cancel">ID：</span>
                        {$vo.id}
                        <span class="split-tab"></span>
                        <span class="text-cancel">商品编号：</span>
                        <a href="{:U('/Item/detail?id='.$vo['id'])}" target="_blank" title="点击商品信息">{$vo.number}</a>
                        <span class="split-tab"></span>
                        <span class="text-cancel">分类：</span>
                        {$vo.category}
                        <span class="split-tab"></span>
                        <span class="text-cancel"> 所属商家： </span>
                        <a href="{:U('Admin/Store/detail?member_id='.$store[$vo['store_id']]['member_id'])}">{$store[$vo['store_id']]['store_name']}</a>
                    </th>
                </tr>
                <tr>
                    <td width="20" class="text-center">
                        <input name="ids[]" class="ids" type="checkbox" value="{$vo['id']}">
                    </td>
                    <td width="50" class="item-lists text-center">
                        <a href="{:U('/Item/detail?id='.$vo['id'])}" target="_blank"><img src="{:get_image_thumb(get_cover($vo['images'], 'path'), 60, 60)}" title="{$vo.title}"></a>
                    </td>
                    <td width="330">
                        <a href="{:U('/Item/detail?id='.$vo['id'])}">{$vo['name']}</a>
                    </td>

                    <td width="105" class="text-center">
                        {$vo['price']}
                    </td>
                    <td width="105" class="text-center">
                        {$vo['item_stock']}
                    </td>
                    <td width="105" class="text-center">
                        {$vo['item_price']}
                    </td>
                    <td width="140" class="text-center">
                        <if condition="$vo['seckill_status'] eq 1">
                            <span class="text-success">已通过</span>
                        </if>
                        <if condition="$vo['seckill_status'] eq 2">
                            <span class="text-cancel">待审核</span>
                        </if>
                        <if condition="$vo['seckill_status'] eq 3">
                                <span class="text-cancel">未通过</span>
                        </if>
                    </td>
                    <td width="140" class="text-center">
                        <a href="{:U('setItemStatus?status=1&ids='.$vo['id'])}" class="ajax-get">[通过]</a>
                        <a href="{:U('setItemStatus?status=3&ids='.$vo['id'])}" class="ajax-get">[驳回]</a>
                    </td>

                </tr>
            </table>
        </volist>
        <else/>
        <div class="list-empty">
            暂无商品！
        </div>
    </notempty>

    <!-- 分页 -->
    <div class="page">
        {$_page}
    </div>
</block>

<block name="script">
    <script type="text/javascript">
        $(function(){
            //导航高亮
            highlight_subnav("{:U('Item/index')}");
            Core.setValue('status', '{:I("get.status")}');

            //隐藏没有分类的下拉框
            var hideCat = {
                init : function(){
                    this.hide('cid_2');
                    this.hide('cid_3');
                },
                hide : function(name){
                    var obj = $("select[name='" + name + "']");
                    if(obj.children('option').length === 1){
                        obj.hide();
                    }
                }
            };
            hideCat.init();
        });
        Core.setValue('supplier_id', '{:I('get.supplier_id', 'all')}');
    </script>
</block>
